package com.hbnu.exercise.File;

import java.io.*;

public class Demo04_CopyImage
{
    public static void main(String[] args)
    {
        String oriPath = "E://TP.png";
        String destPath = "E://test//home.png";

        File oriFile = new File(oriPath);
        File destFile = new File(destPath);

        try
        {
            OutputStream out = new FileOutputStream(destFile);
            InputStream in = new FileInputStream(oriFile);

            int temp = 0;
            while ((temp = in.read()) != -1)
                out.write(temp);
            out.close();
            in.close();
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
    }
}
